<HTML
><HEAD
><TITLE
>Logins via terminals</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.63
"><LINK
REL="HOME"
TITLE="The Linux System Administrator's Guide"
HREF="index.html"><LINK
REL="UP"
TITLE="Logging In And Out"
HREF="log-in-and-out.html"><LINK
REL="PREVIOUS"
TITLE="Logging In And Out"
HREF="log-in-and-out.html"><LINK
REL="NEXT"
TITLE="Logins via the network"
HREF="x2243.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The Linux System Administrator's Guide: Version 0.7</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="log-in-and-out.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 10. Logging In And Out</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x2243.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN2210"
>10.1. Logins via terminals</A
></H1
><P
><A
HREF="x2210.html#TERMINAL-LOGINS"
>Figure 10-1</A
> shows how logins happen via
	terminals.  First, <B
CLASS="COMMAND"
>init</B
> makes sure there is
	a <B
CLASS="COMMAND"
>getty</B
> program for the terminal connection
	(or console).  <B
CLASS="COMMAND"
>getty</B
> listens at the terminal
	and waits for the user to notify that he is ready to login in
	(this usually means that the user must type something).  When it
	notices a user, <B
CLASS="COMMAND"
>getty</B
> outputs a welcome message
	(stored in <TT
CLASS="FILENAME"
>/etc/issue</TT
>), and prompts for
	the username, and finally runs the <B
CLASS="COMMAND"
>login</B
>
	program.  <B
CLASS="COMMAND"
>login</B
> gets the username as a
	parameter, and prompts the user for the password.  If these
	match, <B
CLASS="COMMAND"
>login</B
> starts the shell configured
	for the user; else it just exits and terminates the process
	(perhaps after giving the user another chance at entering the
	username and password).  <B
CLASS="COMMAND"
>init</B
> notices that
	the process terminated, and starts a new <B
CLASS="COMMAND"
>getty</B
>
	for the terminal.
	</P
><DIV
CLASS="FIGURE"
><A
NAME="TERMINAL-LOGINS"
></A
><P
><B
>Figure 10-1. Logins via terminals: the interaction of 
<B
CLASS="COMMAND"
>init</B
>, 
<B
CLASS="COMMAND"
>getty</B
>, <B
CLASS="COMMAND"
>login</B
>, and the 
shell.</B
></P
><P
><IMG
SRC="logins-via-terminals.gif"></P
></DIV
><P
> Note that the only new process is the
	one created by <B
CLASS="COMMAND"
>init</B
> (using the
	<TT
CLASS="FUNCTION"
>fork</TT
> system call); <B
CLASS="COMMAND"
>getty</B
>
	and <B
CLASS="COMMAND"
>login</B
> only replace the program running in
	the process (using the <TT
CLASS="FUNCTION"
>exec</TT
> system call).
	</P
><P
> A separate program, for noticing the user, is needed
	for serial lines, since it can be (and traditionally was)
	complicated to notice when a terminal becomes active.
	<B
CLASS="COMMAND"
>getty</B
> also adapts to the speed and other
	settings of the connection, which is important especially for
	dial-in connections, where these parameters may change from call
	to call.  </P
><P
> There are several versions of <B
CLASS="COMMAND"
>getty</B
>
	and <B
CLASS="COMMAND"
>init</B
> in use, all with their good and
	bad points.  It is a good idea to learn about the versions on
	your system, and also about the other versions (you could use the
	Linux Software Map to search them).  If you don't have dial-ins,
	you probably don't have to worry about <B
CLASS="COMMAND"
>getty</B
>,
	but <B
CLASS="COMMAND"
>init</B
> is still important.  </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="log-in-and-out.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x2243.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Logging In And Out</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="log-in-and-out.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Logins via the network</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>